TEXT ·_packed_mask_neon(SB), $0-32
MOVD input+0(FP),  R0
MOVD output+8(FP), R1
MOVD size+16(FP),  R2

WORD $0xf100205f      // CMP $8, R2
WORD $0x52800108      // MOVW $8, R8
WORD $0x9a883048      // CSEL LO, R2, R8, R8
WORD $0xd341fd09      // LSR $1, R8, R9
WORD $0xf100091f      // CMP $2, R8
WORD $0x54000303      // BCC 24(PC)
WORD $0xd280000a      // MOVD $0, R10
WORD $0xf100053f      // CMP $1, R9
WORD $0x9a9f852c      // CSINC HI, R9, ZR, R12
WORD $0xf940002b      // MOVD (R1), R11
WORD $0xd37ced8c      // LSL $4, R12, R12
WORD $0x3cea6800      // FMOVQ (R0)(R10), F0
WORD $0x6f090400      // VUSHR $7, V0.B16, V0.B16
WORD $0x6f190401      // VUSHR $7, V0.H8, V1.H8
WORD $0x4ea01c20      // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f320401      // VUSHR $14, V0.S4, V1.S4
WORD $0x4ea01c20      // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f641400      // VUSRA $28, V0.D2, V0.D2
WORD $0x0e013c0d      // VMOV V0.B[0], R13
WORD $0x9aca21ad      // LSL R10, R13, R13
WORD $0x0e113c0e      // VMOV V0.B[8], R14
WORD $0x9100214f      // ADD $8, R10, R15
WORD $0x9acf21ce      // LSL R15, R14, R14
WORD $0xaa0b01cb      // ORR R11, R14, R11
WORD $0xaa0d016b      // ORR R13, R11, R11
WORD $0xf900002b      // MOVD R11, (R1)
WORD $0x9100414a      // ADD $16, R10, R10
WORD $0xeb0a019f      // CMP R10, R12
WORD $0x54fffde1      // BNE -17(PC)
WORD $0x360002a8      // TBZ $0, R8, 21(PC)
WORD $0x927f090a      // AND $14, R8, R10
WORD $0x8b0a0c0a      // ADD R10<<3, R0, R10
WORD $0x4f00e400      // VMOVI $0, V0.B16
WORD $0x0d408540      // VLD1 (R10), V0.D[0]
WORD $0x6f090400      // VUSHR $7, V0.B16, V0.B16
WORD $0x6f190401      // VUSHR $7, V0.H8, V1.H8
WORD $0x4ea01c20      // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f320401      // VUSHR $14, V0.S4, V1.S4
WORD $0x4ea01c20      // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f641400      // VUSRA $28, V0.D2, V0.D2
WORD $0x0e013c0a      // VMOV V0.B[0], R10
WORD $0xd37ced29      // LSL $4, R9, R9
WORD $0x9ac92149      // LSL R9, R10, R9
WORD $0x0e113c0a      // VMOV V0.B[8], R10
WORD $0xb2400108      // ORR $1, R8, R8
WORD $0x9ac82148      // LSL R8, R10, R8
WORD $0xf940002a      // MOVD (R1), R10
WORD $0xaa0a0108      // ORR R10, R8, R8
WORD $0xaa090108      // ORR R9, R8, R8
WORD $0xf9000028      // MOVD R8, (R1)
WORD $0xd65f03c0      // RET

TEXT ·_packed_mask2_neon(SB), $0-32
MOVD input+0(FP),  R0
MOVD output+8(FP), R1
MOVD value+16(FP), R2
MOVD size+24(FP),  R3

WORD $0xf100207f    // CMP $8, R3
WORD $0x52800108    // MOVW $8, R8
WORD $0x9a883068    // CSEL LO, R3, R8, R8
WORD $0xd341fd09    // LSR $1, R8, R9
WORD $0x4e010c40    // VDUP R2, V0.B16
WORD $0xf100091f    // CMP $2, R8
WORD $0x54000343    // BCC 26(PC)
WORD $0xd280000a    // MOVD $0, R10
WORD $0xf100053f    // CMP $1, R9
WORD $0x9a9f852c    // CSINC HI, R9, ZR, R12
WORD $0xf940002b    // MOVD (R1), R11
WORD $0xd37ced8c    // LSL $4, R12, R12
WORD $0x4f00e421    // VMOVI $1, V1.B16
WORD $0x3cea6802    // FMOVQ (R0)(R10), F2
WORD $0x6e208c42    // VCMEQ V0.B16, V2.B16, V2.B16
WORD $0x4e211c42    // VAND V1.B16, V2.B16, V2.B16
WORD $0x6f190443    // VUSHR $7, V2.H8, V3.H8
WORD $0x4ea21c62    // VORR V2.B16, V3.B16, V2.B16
WORD $0x6f320443    // VUSHR $14, V2.S4, V3.S4
WORD $0x4ea21c62    // VORR V2.B16, V3.B16, V2.B16
WORD $0x6f641442    // VUSRA $28, V2.D2, V2.D2
WORD $0x0e013c4d    // VMOV V2.B[0], R13
WORD $0x9aca21ad    // LSL R10, R13, R13
WORD $0x0e113c4e    // VMOV V2.B[8], R14
WORD $0x9100214f    // ADD $8, R10, R15
WORD $0x9acf21ce    // LSL R15, R14, R14
WORD $0xaa0b01cb    // ORR R11, R14, R11
WORD $0xaa0d016b    // ORR R13, R11, R11
WORD $0xf900002b    // MOVD R11, (R1)
WORD $0x9100414a    // ADD $16, R10, R10
WORD $0xeb0a019f    // CMP R10, R12
WORD $0x54fffdc1    // BNE -18(PC)
WORD $0x360002e8    // TBZ $0, R8, 23(PC)
WORD $0x927f090a    // AND $14, R8, R10
WORD $0x8b0a0c0a    // ADD R10<<3, R0, R10
WORD $0x4f00e401    // VMOVI $0, V1.B16
WORD $0x0d408541    // VLD1 (R10), V1.D[0]
WORD $0x6e218c00    // VCMEQ V1.B16, V0.B16, V0.B16
WORD $0x4f00e421    // VMOVI $1, V1.B16
WORD $0x4e211c00    // VAND V1.B16, V0.B16, V0.B16
WORD $0x6f190401    // VUSHR $7, V0.H8, V1.H8
WORD $0x4ea01c20    // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f320401    // VUSHR $14, V0.S4, V1.S4
WORD $0x4ea01c20    // VORR V0.B16, V1.B16, V0.B16
WORD $0x6f641400    // VUSRA $28, V0.D2, V0.D2
WORD $0x0e013c0a    // VMOV V0.B[0], R10
WORD $0xd37ced29    // LSL $4, R9, R9
WORD $0x9ac92149    // LSL R9, R10, R9
WORD $0x0e113c0a    // VMOV V0.B[8], R10
WORD $0xb2400108    // ORR $1, R8, R8
WORD $0x9ac82148    // LSL R8, R10, R8
WORD $0xf940002a    // MOVD (R1), R10
WORD $0xaa0a0108    // ORR R10, R8, R8
WORD $0xaa090108    // ORR R9, R8, R8
WORD $0xf9000028    // MOVD R8, (R1)
WORD $0xd65f03c0    // RET
